<template>
  <div v-loading="loading">
    <el-descriptions label-width="100px" :column="4">
      <el-descriptions-item label="项目名称">{{ detailInfo.name }}</el-descriptions-item>
      <el-descriptions-item label="项目编号">{{ detailInfo.prjNum }}</el-descriptions-item>
      <el-descriptions-item label="项目状态">
        <el-tag v-if="detailInfo.prjStatus == 1" type="info"> {{ detailInfo.prjStatusName }}</el-tag>
        <el-tag v-if="detailInfo.prjStatus == 2"> {{ detailInfo.prjStatusName }}</el-tag>
        <el-tag v-if="detailInfo.prjStatus == 3" type="danger"> {{ detailInfo.prjStatusName }}</el-tag>
        <el-tag v-if="detailInfo.prjStatus == 4" type="success"> {{ detailInfo.prjStatusName }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="建设性质"
        ><el-tag v-show="detailInfo.propertyNumName">{{ detailInfo.propertyNumName }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="行业分类">
        <el-tag v-show="detailInfo.industryTypeName">{{ detailInfo.industryTypeName }}</el-tag></el-descriptions-item
      >
      <el-descriptions-item label="项目分类"
        ><el-tag v-show="detailInfo.categoryName">{{ detailInfo.categoryName }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="项目种类">
        <el-tag v-show="detailInfo.fundsSourceName">{{ detailInfo.fundsSourceName }}</el-tag></el-descriptions-item
      >
      <el-descriptions-item :label="detailInfo.industryType == 1 ? '建筑市场监管平台编号' : '行业主管部门项目编号'">{{
        detailInfo.industryPrjNum
      }}</el-descriptions-item>
      <el-descriptions-item label="用地许可证编号">{{ detailInfo.buildPlanNum }}</el-descriptions-item>
      <el-descriptions-item label="项目所在地区">{{ detailInfo.cityName }}</el-descriptions-item>
      <el-descriptions-item label="施工许可证编号">{{ detailInfo.builderLicences }}</el-descriptions-item>
      <el-descriptions-item label="施工许可证发证日期">{{ detailInfo.builderLicencesGrantDate }}</el-descriptions-item>
      <el-descriptions-item label="施工许可证有效期限">{{ detailInfo.builder_licencesTermDate }}</el-descriptions-item>
      <el-descriptions-item label="中标合同价格(工程造价)">{{ detailInfo.contractAmount }}</el-descriptions-item>
      <el-descriptions-item label="合同开工日期">{{ detailInfo.contractStartDate }}</el-descriptions-item>
      <el-descriptions-item label="实际开工日期">{{ detailInfo.startDate }}</el-descriptions-item>
      <el-descriptions-item label="合同竣工日期">{{ detailInfo.contractEndDate }}</el-descriptions-item>
      <el-descriptions-item label="实际竣工日期">{{ detailInfo.endDate }}</el-descriptions-item>
      <el-descriptions-item label="总面积">{{ detailInfo.buildingArea }}</el-descriptions-item>
      <el-descriptions-item label="总长度">{{ detailInfo.buildingLength }}</el-descriptions-item>
      <el-descriptions-item label="中标通知书编号">{{ detailInfo.letterAcceptanceNum }}</el-descriptions-item>
      <el-descriptions-item label="招标标段编号">{{ detailInfo.biddingSectionNum }}</el-descriptions-item>
      <el-descriptions-item label="是否树立维权告示牌">
        <el-tag v-if="detailInfo.hasSafeguardingBoard">是</el-tag>
        <el-tag v-else type="warning"> 否</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="多地施工点位">
        <el-tag type="warning"> {{ detailInfo.positionCount }}</el-tag></el-descriptions-item
      >
      <el-descriptions-item label="联系人">{{ detailInfo.linkMan }}</el-descriptions-item>
      <el-descriptions-item label="联系电话">{{ detailInfo.linkPhone }}</el-descriptions-item>
      <el-descriptions-item label="项目地址">{{ detailInfo.address }}</el-descriptions-item>
      <el-descriptions-item label="项目简介">{{ detailInfo.description }}</el-descriptions-item>
      <el-descriptions-item label="担保单位名称">{{ detailInfo.earnestUnitName }}</el-descriptions-item>
      <el-descriptions-item label="担保单位社会统一信用代码">{{ detailInfo.earnestUnitCode }}</el-descriptions-item>
      <el-descriptions-item label="担保金额">{{ detailInfo.earnestMoney }}</el-descriptions-item>
      <el-descriptions-item label="担保开始日期">{{ detailInfo.earnestStartDate }}</el-descriptions-item>
      <el-descriptions-item label="担保终止日期">{{ detailInfo.earnestEndDate }}</el-descriptions-item>
      <el-descriptions-item label="中标通知书/施工合同">
        <span v-for="item in detailInfo.letterAttachments" :key="item.attachmentId">
          <el-link type="primary">{{ item.attachmentName }}</el-link>
        </span>
      </el-descriptions-item>
      <el-descriptions-item label="担保文件">
        <span v-for="item in detailInfo.earnestAttachments" :key="item.attachmentId">
          <el-link type="primary">{{ item.attachmentName }}</el-link>
        </span>
      </el-descriptions-item>
    </el-descriptions>
  </div>
</template>
<script setup lang="ts">
import { GetProjectBaseInfo } from "@/api/project/projectInfo/index";
const props = defineProps({
  id: {
    type: Number,
    default: 0,
  },
});
const { id } = toRefs(props);
const detailInfo = ref<any>({});
const loading = ref<boolean>(false);

//初始化
const initForm = () => {
  loading.value = true;
  GetProjectBaseInfo(id.value)
    .then((res) => {
      if (res.success) {
        detailInfo.value = res.data;
      }
    })
    .finally(() => {
      loading.value = false;
    });
};

onMounted(() => {
  initForm();
});
</script>

<style scoped>
:deep(.el-descriptions-item) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
</style>
